package com.cf.r944_ak;

import java.io.*;

public class e {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);

        in.nextToken();
        int t = (int) in.nval;
        while (t-- > 0) {

            in.nextToken(); int n = (int) in.nval;
            in.nextToken(); int k = (int) in.nval;
            in.nextToken(); int q = (int) in.nval;

            long[] a = new long[k + 1];
            long[] b = new long[k + 1];

            for (int i = 1; i <= k; i++) {
                in.nextToken();
                a[i] = (long) in.nval;
            }

            for (int i = 1; i <= k; i++) {
                in.nextToken();
                b[i] = (long) in.nval;
            }

            while (q-- > 0) {
                in.nextToken(); long d = (int) in.nval;
                int i = find(a, d);
                if (a[i] == d) {
                    out.print(b[i] + " ");
                } else {
                    long ans = b[i] + (b[i + 1] - b[i]) * (d - a[i]) / (a[i + 1] - a[i]);
                    out.print(ans + " ");
                }
            }
            out.println();
        }
        out.flush();
        out.close();
        br.close();
    }

    public static int find(long[] a, long d) {
        int ans = 0;
        int l = 0;
        int r = a.length - 1;

        while (l <= r) {
            int mid = (l + r) / 2;
            if (a[mid] <= d) {
                ans = mid;
                l = mid + 1;
            } else {
                r = mid - 1;
            }
        }

        return ans;
    }
}
